package com.google.gwt.sample.dynatablerf.client.presenters;

import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.IsWidget;

public abstract class AbstractPresenter {

	private EventBus eventBus;

	public AbstractPresenter(EventBus eventBus) {
		super();
		this.eventBus = eventBus;
	}

	public void go(HasWidgets hasWidgets) {
		hasWidgets.clear();
		bind();
		hasWidgets.add(getDisplay().asWidget());
	}

	protected abstract void bind();

	protected abstract IsWidget getDisplay();

	protected EventBus getEventBus() {
		return eventBus;
	}
}
